/**
  * Author: Mei
  * Date: 2020-12-13 15:11
  * Description:
  *
  */
#include "../head.h"

using namespace std;

//类型表
template<typename T>
struct Iterator1 {
public:
    typedef T value_type;
    typedef value_type *pointer;
    typedef value_type &reference;
};
template<typename T>
struct Iterator2 {
public:
    typedef T value_type;
    typedef value_type *pointer;
    typedef value_type &reference;
};

//改造 汇总同类类模板的内嵌数据类型表形成统一接口
template<typename T>
struct Traits1 {
    typedef typename T::pointer value_type;
    typedef typename T::pointer pointer;
    typedef typename T::reference reference;

};
template<typename T>
struct Traits1<T *> {
    typedef T value_type;
    typedef value_type *pointer;
    typedef value_type &reference;

};
int main() {
    int n = 10;
    typename Iterator1<int>::reference a = n;
    cout << a << endl;

    Traits1<Iterator1<int>>::value_type b = &n;
    cout << *b << endl;

    Traits1<double*>::value_type b1 = n;
    cout << b1 << endl;


    return 0;
}